From: Hans Dedecker Date: Fri, 17 May 2019 16:27:59 +0000 (+0200) Subject: interface-ip: use ptp address as well to find local address target X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=22e8e589fd6ab5d19dc1d3c9d1bcf2bfabf1fafb;p=project%2Fnetifd.git interface-ip: use ptp address as well to find local address target In case of tunnel over PPP(such as gretap over l2tp): tunnel interface use PPP's peer address as remote address, netifd script will call proto_add_host_dependency function, then netifd will search which device can reach to the remote address. Before the patch, netifd don't consider the PPP interface can reach to the remote address, so netifd will select default route to remote address, it will lead to remote address unreachable. Based on a patch by xiaofan Signed-off-by: Hans Dedecker --- diff --git a/interface-ip.c b/interface-ip.c index d4f428d..864de50 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -196,6 +196,10 @@ __find_ip_addr_target(struct interface_ip_settings *ip, union if_addr *a, bool v if (v6 != ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6)) continue; + if (((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET4) && + addr->point_to_point && a->in.s_addr == addr->point_to_point) + return true; + /* Handle offlink addresses correctly */ unsigned int mask = addr->mask; if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6 &&